from die import Die
import pygal

die_1 = Die()
die_2 = Die(10)
results = [die_1.roll_die()+die_2.roll_die() for roll in range(1000)]
# print(results)
max_result = die_1.sides + die_2.sides
frequencies = [results.count(value) for value in range(1,max_result+1)]
# 对结果进行可视化
hist = pygal.Bar()
hist.title = "Results of rolling one D6 1000 times"
hist.x_labels = [str(value) for value in range(1, max_result+1)]
hist.x_title = "Result"
hist.y_title = "Frequency of Result"
hist.add('D6+D6', frequencies)
hist.render_to_file('dice_visual.svg')